/*******************************************************************************
 * Copyright 2011 @ Kapil Viren Ahuja
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package com.kapil.framework.reader;


/**
 * @author Kapil Viren Ahuja
 *
 * Creates instances of @see MessageReader.
 */
public final class ConfigurationReaderFactory
{
	private static final ConfigurationReaderFactory LOCAL_INSTANCE = new ConfigurationReaderFactory();

	/**
	 * Default constructor.  Made private to enforce Singleton pattern.
	 */
	private ConfigurationReaderFactory()
	{
	}

	/**
	 * Returns the singleton instance of the class.
	 * @return
	 */
	public static ConfigurationReaderFactory getInstance()
	{
		return LOCAL_INSTANCE;
	}

	/**
	 * Returns a @see MessageReader instance suitable for reading messages from a specified data source.
	 * 
	 * @param dataSourceName Name of the data source from which messages need to be read.
	 * @return A @see MessageReader instance.
	 */
	public ConfigurationReader getReader(final String dataSourceName)
	{
		return new XMLConfigurationReader(dataSourceName);
	}
}
